package com.project.util;

import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

import java.time.LocalDate;

@Component
public class DateChange implements Converter<String, LocalDate> {
    @Override
    public LocalDate convert(String source) {
        if(source != null &&
                source.matches("(19|20)\\d{2}-\\d{2}-\\d{2}")){
            return LocalDate.parse(source);
        }

        return null;
    }
}
